<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUuidWhiteListTable extends Migration
{
    private const TABLE = 'uuid_white_list';

    public function up()
    {
        if (Schema::connection('gameCenter')->hasTable(self::TABLE)) {
            return;
        }
        Schema::connection('gameCenter')->create(self::TABLE, function (Blueprint $table) {
            $table->id();
            $table->string('uuid')->default('')->comment('UUID');
            $table->string('remark')->default('')->comment('备注');
            $table->timestamp('created_at');

            $table->index('uuid');
        });
        DB::connection('gameCenter')->statement("ALTER TABLE `tb_".self::TABLE."` comment 'UUID白名单'");
    }

    public function down()
    {
        Schema::connection('gameCenter')->dropIfExists(self::TABLE);
    }
}
